package com.google.code.iproc;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.google.code.iproc.util.IntegerRange;
import com.itextpdf.text.pdf.PdfDestination;

public class ToCEntry {

	private final String title;
	private final List<String> authors;
	private final Location location;
	private final int indentLevel;
	
	public ToCEntry( final String title, final int indentLevel ) {
		super();
		this.title = title;
		this.authors = null;
		this.location = null;
		this.indentLevel = indentLevel;
	}

	public ToCEntry( final String title, final List<String> authors, final IntegerRange pageRange, final int indentLevel ) {
		super();
		this.title = title;
		this.authors = Collections.unmodifiableList( new ArrayList<String>( authors ) );
		this.location = new Location( pageRange, null );
		this.indentLevel = indentLevel;
	}

	public ToCEntry( final String title, final List<String> authors, final Location location, final int indentLevel ) {
		super();
		this.title = title;
		this.authors = Collections.unmodifiableList( new ArrayList<String>( authors ) );
		this.location = location;
		this.indentLevel = indentLevel;
	}

	public String getTitle() {
		return title;
	}

	public List<String> getAuthors() {
		return authors;
	}

	public Location getLocation() {
		return location;
	}
	
	public int getIndentLevel() {
		return indentLevel;
	}
	
	public static class Location {
		
		private final IntegerRange pages;
		private final PdfDestination dest;
		
		public Location( IntegerRange pages, PdfDestination dest ) {
			super();
			this.pages = pages;
			this.dest = dest;
		}

		public IntegerRange getPages() {
			return pages;
		}

		public PdfDestination getDest() {
			return dest;
		}
		
	}
}

class ToCSection extends ToCEntry {
	
	public ToCSection( final String title ) {
		super( title, 0 );
	}

}

class ToCSectionEnd extends ToCEntry {
	
	public ToCSectionEnd() {
		super( null, 0 );
	}

}